<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" :width="1200" destroy-on-close @closed="$emit('closed')" :close-on-click-modal="false" align-center>
		<el-container>
			<el-container>
				<el-main class="nopadding">
					<scTable ref="table" :data="data" :params="params" row-key="id"
							 @selection-change="selectionChange" stripe remoteSort remoteFilter height="600">
<!--						<el-table-column type="selection" width="50" reserve-selection></el-table-column>-->
						<el-table-column label="物料编码" prop="custom_name" width="100"></el-table-column>
						<el-table-column label="物料名称" prop="date" width="100"></el-table-column>
						<el-table-column label="规格型号" prop="order_no" width="120"></el-table-column>
						<el-table-column label="单位" prop="apply_name" width="100"></el-table-column>
						<el-table-column label="材料用量" prop="factory_number" width="100"></el-table-column>
						<el-table-column label="损耗率（%）" prop="custom_code" width="160"></el-table-column>
						<el-table-column label="发料方式" prop="yarnInfo.material_name" width="150"></el-table-column>
						<el-table-column label="发料仓库" prop="component" width="150"></el-table-column>
					</scTable>
				</el-main>
			</el-container>
		</el-container>
	</el-dialog>
</template>

<script>

export default {
	emits: ['success', 'closed'],
	components: {

	},
	data() {
		return {
			mode: "add",
			titleMap: {
				add: '查看物料',
				edit: '查看物料',
				show: '查看物料'
			},
			visible: false,
			isSaveing: false,
			// apiObj: this.$API.order.yarnOrder.list,
			selection: [],
			form: {},
			search: {
				order_no: null,
				time:null
			},
			params:{},
			data:[
				{custom_name:'11'},{custom_name:'11'},{custom_name:'11'},{custom_name:'11'}
			]
		}
	},
	watch: {

	},
	mounted() {

	},
	methods: {
		setData(data) {
			if(data.yarn_id) {
				this.params.material_id = data.yarn_id
			}
		},
		//表格选择后回调事件
		selectionChange(selection) {
			this.selection = selection;
		},
		//显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
		//搜索
		upsearch() {
			this.$refs.table.upData(this.search)
		},
		/**清空搜索*/
		clearSearch() {
			this.search = {
				order_no: null,
				time:null
			}
			this.upsearch()
		},
	}
}
</script>

<style></style>
